package matchers;

import org.apache.lucene.search.spell.NGramDistance;

import matchers.com.berico.similarity.CosineSimilarity;
import matchers.com.berico.similarity.JaccardSimilarity;
import matchers.com.berico.similarity.JaroWinklerSimilarity;
import matchers.com.berico.similarity.SimilarityRunner;
import matchers.com.berico.similarity.SorensenSimilarity;


public class LinguisticMatchersFacade {
	
	public double get2GramSimilarity(String source, String target, int n) {
		NGramDistance ngd = new NGramDistance(n);
		return ngd.getDistance(source, target);
	}
	
	public double getCosineSimilarity(String source, String target) {
		return SimilarityRunner.getSimilarity(new CosineSimilarity(), source, target)/100;
	}
	
	public double getJaccardSimilarity(String source, String target) {
		return SimilarityRunner.getSimilarity(new JaccardSimilarity(), source, target)/100;
	}
	
	public double getSorensenSimilarity(String source, String target) {
		return SimilarityRunner.getSimilarity(new SorensenSimilarity(), source, target)/100;
	}
	
	public double getJaroWinklerSimilarity(String source, String target) {
		return SimilarityRunner.getSimilarity(new JaroWinklerSimilarity(), source, target)/100;
	}

	
	
}
